package gem.model.dao;

public class MySqlDAOFactory extends DAOFactory
{

	public static final String jdbcDriver = "com.mysql.jdbc.Driver";
	public static final String jdbcURL = "jdbc:mysql://localhost/gem?user=root&password=test&characterSetResults=UTF-8&characterEncoding=UTF8&useUnicode=true";
	
	private static MySqlDepartmentDAO depDAO = null;
	private static MySqlScienceDomainDAO sdDAO = null;
	private static MySqlCourseDAO cDAO = null;
	
	java.sql.Connection getConnection()
	{
		// TODO: from pool, fetch connection
		return null;
	}
	
	@Override
	public CourseDAO getCourseDAO()
	{
		if( cDAO == null )
		{
			cDAO = new MySqlCourseDAO();
		}
		return cDAO;
	}

	@Override
	public ScienceDomainDAO getScienceDomainDAO()
	{
		if( sdDAO == null )
		{
			sdDAO = new MySqlScienceDomainDAO();
		}
		return sdDAO;
	}

	@Override
	public DepartmentDAO getDepartmentDAO()
	{
		if( depDAO == null )
		{
			depDAO = new MySqlDepartmentDAO();
		}
		return depDAO;
	}

}
